import BuildSettings._
import Dependencies._
import sbt.Keys._
import sbt._


import sbtassembly._
import AssemblyKeys._
import AssemblyPlugin._

object Build extends Build {

  final val DependsOnCompileOnly = "test->compile;compile->compile"

  override lazy val settings = super.settings :+ {
    shellPrompt := (s => Project.extract(s).currentProject.id + " > ")
  }

  ///////////////////////////////////////////////////////////////
  // root project
  ///////////////////////////////////////////////////////////////
  lazy val root = Project("sbt-project", file("."))
    //    .enablePlugins(PlayScala)
    .settings(assemblySettings ++ commonSettings: _*)
    .settings(
      description := "sbt-project",
      unmanagedBase := baseDirectory.value / "libs",
      libraryDependencies ++= __compile(_playMini) ++ __compile(_mysql) ++ __compile(_slick) ++ __compile(_hikariCP) ++ __test(_scalatestPlay),
      //      mainClass in assembly := Some("com.typesafe.play.mini.NettyServer"),
      assemblyJarName in assembly := "image-manage-service.jar",
      test in assembly := {},
      assemblyOption in assemblyPackageDependency ~= {
        _.copy(appendContentHash = true)
      },
      assemblyMergeStrategy in assembly := {
        case PathList("org", "slf4j", xs@_*) => MergeStrategy.first
        case PathList(ps@_*) if ps.last endsWith "axiom.xml" => MergeStrategy.filterDistinctLines
        case PathList(ps@_*) if ps.last endsWith "Log.class" => MergeStrategy.first
        case PathList(ps@_*) if ps.last endsWith "LogConfigurationException.class" => MergeStrategy.first
        case PathList(ps@_*) if ps.last endsWith "LogFactory.class" => MergeStrategy.first
        case PathList(ps@_*) if ps.last endsWith "SimpleLog$1.class" => MergeStrategy.first
        case "application.conf" => MergeStrategy.concat
        case x => (assemblyMergeStrategy in assembly).value.apply(x)
      }
    )


  ///////////////////////////////////////////////////////////////
  // projects
  ///////////////////////////////////////////////////////////////


}

